package com.lww.service.impl;

import static org.hamcrest.CoreMatchers.nullValue;

import java.sql.SQLException;
import java.util.List;

import com.lww.dao.UserDao;
import com.lww.entity.User;
import com.lww.factory.DaoFactory;
import com.lww.service.UserService;

public class UserServiceImpl implements UserService{

	@Override
	public List<User> findAllUser() {
		UserDao userDao = DaoFactory.getInstance().getUserDao();
		System.out.println(userDao);
		List<User> list = null;
		try {
			list = userDao.findAll();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return list;
	}

	@Override
	public void deleteUser(int id) {
		UserDao userDao = DaoFactory.getInstance().getUserDao();
		try {
			userDao.delete(id);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}
